const bcrypt = require('bcrypt');
module.exports = {
	//加密密码
	async hashPass(plain) {
		try {
			const salt = await bcrypt.genSalt(10);
			return await bcrypt.hash(plain, salt);
		} catch (err) {
			throw err;
		}
	},
	//验证密码
	async verifyPass(plain, hashed) {
		try {
			return await bcrypt.compare(plain, hashed);
		} catch (err) {
			throw err;
		}
	}
};